home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 18
/
CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso
/
CUCD
/
Programming
/
AmigaE
/
Src
/
Class
/
Stack
/
stack.e
next >
Wrap
Text File
|
1992-09-02
|
543b
|
36 lines
-> Jaaaa, a true STACK in E! :-)
OPT MODULE
EXPORT OBJECT stack
PRIVATE d:PTR TO LONG
ENDOBJECT
PROC stack() OF stack -> constructor
self.d:=NIL
ENDPROC
PROC is_empty() OF stack IS self.d=NIL
PROC push(x) OF stack
self.d:=NEW [self.d,x]:LONG
ENDPROC
PROC pop() OF stack
DEF a:PTR TO LONG,b
IF a:=self.d
self.d:=a[]; b:=a[1]
END a[2]
ELSE
Raise("estk")
ENDIF
ENDPROC b
PROC end() OF stack -> destructor
DEF a:PTR TO LONG,b:PTR TO LONG
a:=self.d
WHILE a
b:=a; a:=a[]; END b[2]
ENDWHILE
ENDPROC